home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Utilities / TeleCommunications / Packet Macs v1.32 / card_3167.txt < prev    next >
Encoding:
Text File  |  1988-05-01  |  7.2 KB  |  284 lines

  1. -- card: 3167 from stack: in.32
  2. -- bmap block id: 4210
  3. -- flags: 4000
  4. -- background id: 2738
  5. -- name: First Card
  6. ----- HyperTalk script -----
  7. on startUp
  8.   set userLevel to 1
  9.   hide message box
  10.   hide menuBar
  11. end startUp
  12.  
  13. on openCard
  14.   set userLevel to 1
  15.   hide message box
  16.   hide menuBar
  17. end openCard
  18.  
  19.  
  20. -- part 1 (button)
  21. -- low flags: 00
  22. -- high flags: 2003
  23. -- rect: left=4 top=296 right=333 bottom=45
  24. -- title width / last selected line: 65535
  25. -- icon id / first selected line: -15184 / 50352
  26. -- text alignment: 1
  27. -- font id: 0
  28. -- text size: 12
  29. -- style flags: 0
  30. -- line height: 16
  31. -- part name: How Many?
  32. ----- HyperTalk script -----
  33. on mouseUp
  34.   get number of cards
  35.   subtract 1 from It
  36.   set location of message box to 19,134
  37.   put it && " Mac using packet hams are listed in this stack." into message
  38. end mouseUp
  39.  
  40.  
  41.  
  42. -- part 2 (button)
  43. -- low flags: 00
  44. -- high flags: 2003
  45. -- rect: left=4 top=296 right=333 bottom=45
  46. -- title width / last selected line: 65535
  47. -- icon id / first selected line: -15184 / 50352
  48. -- text alignment: 1
  49. -- font id: 0
  50. -- text size: 12
  51. -- style flags: 0
  52. -- line height: 16
  53. -- part name: How Many?
  54. ----- HyperTalk script -----
  55. on mouseUp
  56.   get number of cards
  57.   subtract 1 from It
  58.   set location of message box to 19,134
  59.   put it && " Mac using packet hams are listed in this stack." into message
  60. end mouseUp
  61.  
  62.  
  63.  
  64. -- part 3 (button)
  65. -- low flags: 00
  66. -- high flags: A003
  67. -- rect: left=449 top=304 right=325 bottom=511
  68. -- title width / last selected line: 0
  69. -- icon id / first selected line: 0 / 0
  70. -- text alignment: 1
  71. -- font id: 0
  72. -- text size: 12
  73. -- style flags: 0
  74. -- line height: 16
  75. -- part name: Author
  76. ----- HyperTalk script -----
  77. on mouseUp
  78.   flash 2
  79.   wait 10 ticks
  80.   ask "             Created by Ray Terry - N6PHJ " with "   SysOp of MacScience BBS  (408) 247-8307 "
  81. end mouseUp
  82.  
  83.  
  84. -- part 4 (button)
  85. -- low flags: 00
  86. -- high flags: 2001
  87. -- rect: left=404 top=180 right=197 bottom=428
  88. -- title width / last selected line: 0
  89. -- icon id / first selected line: 0 / 0
  90. -- text alignment: 1
  91. -- font id: 0
  92. -- text size: 12
  93. -- style flags: 0
  94. -- line height: 16
  95. -- part name: New Button
  96. ----- HyperTalk script -----
  97. on mouseUp
  98.   set userlevel to 5
  99.   show menubar
  100. end mouseUp
  101.  
  102.  
  103.  
  104. -- part 5 (button)
  105. -- low flags: 00
  106. -- high flags: A001
  107. -- rect: left=22 top=210 right=253 bottom=53
  108. -- title width / last selected line: 65535
  109. -- icon id / first selected line: -15186 / 50350
  110. -- text alignment: 1
  111. -- font id: 0
  112. -- text size: 12
  113. -- style flags: 0
  114. -- line height: 16
  115. -- part name: to text
  116. ----- HyperTalk script -----
  117. function fixfield s -- convert field s into exportable form,
  118. global fsep -- field separator character
  119. global rsep -- record separator character
  120. put false into quoted -- true if we need to quote the string
  121. put false into hasquotes -- true if string s contains quotes
  122.  
  123. if offset(quote, s) <> 0 then
  124.   put true into quoted
  125.   put true into hasquotes
  126. else
  127.   if offset("," , s) <> 0 then
  128.     put true into quoted
  129.   else
  130.     if offset(tab, s) <> 0 then
  131.       put true into quoted
  132.     else
  133.       if offset(return,s) <> 0 then
  134.         put true into quoted
  135.       else
  136.         if offset (fsep,s) <> 0 then
  137.           put true into quoted
  138.         else
  139.           if offset (rsep, s) <> 0 then
  140.             put true into quoted
  141.           end if
  142.         end if
  143.       end if
  144.     end if
  145.   end if
  146. end if
  147.  
  148. if hasquotes then -- convert all quotes to doubled quotes
  149.   put empty into outstr -- will hold fixed-up string
  150.   put s into t -- use a copy
  151.   repeat
  152.     put offset(quote, t) into p
  153.     if p = 0 then -- no more quotes
  154.       put t after outstr -- copy rest of t
  155.       exit repeat
  156.     end if
  157.     put char 1 to p of t after outstr -- copy up to quote
  158.     put quote after outstr -- add another quote
  159.     put char p+1 to length(t) of t into temp -- rest of t after quote
  160.     put temp into t
  161.   end repeat
  162. else
  163.   put s into outstr
  164. end if
  165. if quoted then
  166.   return quote & outstr & quote
  167. else
  168.   return outstr
  169. end if
  170. end fixfield
  171.  
  172. on mouseUp -- export a stack to a text file
  173.   global fsep -- field separator character
  174.   global rsep -- record separator character
  175.   global cardfields -- false if exporting only background fields
  176.   global firstline -- true if first export line has field names
  177.   global mailmerge -- true if exporting with quotes around special chars
  178.  
  179.   if fsep = empty then put tab into fsep -- initialize globals if needed
  180.   if rsep = empty then put return into rsep
  181.   if cardfields = empty then put false into cardfields
  182.   if firstline = empty then put true into firstline
  183.   if mailmerge = empty then put true into mailmerge
  184.  
  185.   put the short name of this stack && "Export" into temp -- default name
  186.   ask "Name of output file?" with temp
  187.   if length(it) = 0 then exit mouseup -- user cancelled
  188.   put it into filenam
  189.   open file filenam
  190.  
  191.   go card 1
  192.  
  193.   set lockScreen to true
  194.   set cursor to 4 -- watch cursor
  195.  
  196.   if firstline then -- write field names
  197.     put "Exporting field names" -- keep user informed
  198.     put number of fields into nfields
  199.     put number of card fields into cfields
  200.     put nfields + cfields into allfields
  201.     repeat with i = 1 to nfields -- first do background field names
  202.       put the short name of field i into s
  203.       if mailmerge then
  204.         put fixfield(s) into temp -- convert s to mail merge format
  205.         write temp to file filenam
  206.       else
  207.         write s to file filenam
  208.       end if
  209.       if (i < nfields) or (cardfields and i < allfields) then
  210.         write fsep to file filenam
  211.       else
  212.         write rsep to file filenam
  213.       end if
  214.     end repeat
  215.     if cardfields then -- write card field names if flag is set
  216.       repeat with i = 1 to cfields
  217.         put the short name of card field i into s
  218.         if mailmerge then
  219.           put fixfield(s) into temp
  220.           write temp to file filenam
  221.         else
  222.           write s to file filenam
  223.         end if
  224.         if i < cfields then
  225.           write fsep to file filenam
  226.         else
  227.           write rsep to file filenam
  228.         end if
  229.       end repeat
  230.     end if
  231.   end if -- if firstline
  232.  
  233.   put number of cards into numcards
  234.   repeat with i = 1 to numcards -- write the cards
  235.     put "Exporting card " & i -- keep user informed
  236.     put number of fields into nfields
  237.     put number of card fields into cfields
  238.     put nfields + cfields into allfields
  239.     repeat with j = 1 to nfields -- write the background fields
  240.       put field j into s
  241.       if mailmerge then
  242.         put fixfield(s) into temp
  243.         write temp to file filenam
  244.       else
  245.         write s to file filenam
  246.       end if
  247.       if (j < nfields) or (cardfields and j < allfields) then
  248.         write fsep to file filenam
  249.       else
  250.         write rsep to file filenam
  251.       end if
  252.     end repeat
  253.     if cardfields then -- write the card fields if flag is set
  254.       repeat with j = 1 to cfields -- write the card fields
  255.         put card field j into s
  256.         if mailmerge then
  257.           put fixfield(s) into temp
  258.           write temp to file filenam
  259.         else
  260.           write s to file filenam
  261.         end if
  262.         if j < cfields then
  263.           write fsep to file filenam
  264.         else
  265.           write rsep to file filenam
  266.         end if
  267.       end repeat
  268.     end if
  269.     go next card -- done with one card, advance to next
  270.   end repeat -- i = 1 to numcards
  271.  
  272.   close file filenam
  273.   set lockScreen to false
  274.   put "All done, " & numcards & " cards total"
  275. end mouseUp
  276.  
  277.  
  278.  
  279. -- part contents for background part 24
  280. ----- text -----
  281.  
  282.  
  283.  
  284.